<template>
  <div class="login">
    <Header />
    <div class="cistern">
      <div class="con">
        <h2>登 录</h2>
        <label for>
          账号
          <input v-model="loginInt.usename" type="text" />
        </label>
        <label for>
          密码
          <input v-model="loginInt.password" type="text" />
        </label>
        <p class="tips" v-show="tips">密码或账号输入错误！</p>
        <input @click="submit" type="submit" value="登录" />
        <p class="set-password">
          <a href="javascript:;">修改密码</a> |
          <a href="javascript:;">忘记密码</a>
        </p>
        <div class="other">
          <!-- <h6>其他登录方式</h6> -->
        </div>
        <div class="login">
          没有账号？
          <router-link to="/register">立即创建</router-link>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Header from "../../components/header.vue";
export default {
  name: "login",
  components: {
    Header
  },
  data() {
    return {
      loginInt: {
        usename: "",
        password: ""
      },
      tips: false
    };
  },
  methods: {
    submit() {
      this.$axios
        .post("/login", this.loginInt)
        .then(res => {
          if (res.data === "true") {
            window.location = "/personal-center/success";
          } else {
            this.tips = true;
          }
        })
        .catch(err => {
          console.log(err);
        });
    }
  }
};
</script>

<style lang="less" scoped>
@import "../../assets/css/base.less";
.login {
  .con {
    width: 600px;
    height: 600px;
    background: @cf8;
    margin: 100px auto;
    padding: 100px 150px;
    border-radius: 100%;
    h2 {
      text-align: center;
      color: @c1;
      padding-bottom: 10px;
      font-size: 36px;
    }
    label {
      display: block;
      margin-top: 10px;
      input {
        width: 100%;
        height: 40px;
        line-height: 40px;
        margin-top: 5px;
        padding: 0 10px;
        border: 1px solid @ce6;
        outline: none;
      }
    }
    .tips {
      font-size: 12px;
      color: @ch;
    }
    input[type="submit"] {
      width: 100%;
      height: 40px;
      margin-top: 20px;
      background: @ch;
      outline: none;
      border: none;
      color: @cf;
      font-size: 16px;
      line-height: 20px;
      &:hover {
        cursor: pointer;
      }
    }
    .set-password {
      font-size: 12px;
      text-align: right;
      padding-top: 20px;
      a {
        color: @c1;
        &:hover {
          color: @ch;
        }
      }
    }
    .other {
      text-align: center;
      font-weight: normal;
      border-top: 1px solid @ce6;
      padding-top: 20px;
      margin-top: 20px;
    }
    .login {
      text-align: center;
      a {
        color: @ch;
        &:hover {
          border-bottom: 1px solid @ch;
        }
      }
    }
  }
}
</style>